<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="Trainercity v1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" />
<meta name="Description" content="<?php echo $this->_var['description']; ?>" />
<title><?php echo $this->_var['page_title']; ?></title>
<link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" />

<?php echo $this->smarty_insert_scripts(array('files'=>'common.js,user.js,transport.js')); ?>
<script type="text/javascript">

function check_project() 
{
  	var frm            = document.forms['project_edit'];
  	var subject 	   = frm.elements['subject'].value;
  	var province       = jtrim(frm.elements['province'].value.toLowerCase());
  	var content        = frm.elements['content'].value;
  	var msg = '';
  	var reg = null;

  	if ((subject.length == 0) || (province.length == 0) || (content.length == 0))
  	{
    	msg += 'Please enter all required fields ';
  	}
  
  	var city = "<?php echo $this->_var['citys']; ?>".toLowerCase();
  	if((city.indexOf(province))== -1)
  	{
  		msg += '\r\n There is no such city ' + province;
  	}

  	if (msg.length > 0)
  	{ 
  		alert(msg);
    	return false;
  	}
  	else
  	{
    	return true;
  	}
}

function  jtrim(s)  
{  
   	var  i,b=0,e=s.length;  
    for(i=0;i<s.length;i++) //去左空格
          if(s.charAt(i)!=' '){b=i;break;}  
    if(i==s.length)  
        return  "";  

   	for(i=s.length-1;i>b;i--)  去右空格
       if(s.charAt(i)!=' '){e=i;break;}  
  	return  s.substring(b,e+1);  
}


</script>
</head>
<body>
 	<?php echo $this->fetch('library/page_header.lbi'); ?>
    <div class="post_title" align="center" style="width:100%;"><span style="color:#6A97C3;">1. Post fitness goals </span> >> 2. Review >> 3. Done</div>
	<form name="project_edit" action="projects.php" method="post" onsubmit="return check_project()">		
       <div class="lcl_xincon">  	    
         <p class="font_listt">1. Tell us about your fitness training goals</p>
			<div class="lcl_xincon01" style="width:800px;">
            	<div class="lcl_xinconzi font20">* My Fitness Goal is _____ :</div>
                <div class="lcl_xinconform">
				<input type="text" name="subject" id="textfield" class="lcl_texte01" maxlength="35" value="<?php echo $this->_var['project']['subject']; ?>"  style="text-align:left" onblur="checkSubject(this.value);"/>
				
				</div>
				<div id="subject_notice" style="color:#FF0000;"></div>
            </div>
             <div class="lcl_xincon01" >
               <div class="lcl_xinconzi font20">* I am looking for</div>
               <div class="lcl_xinconform">
			   <select id="trainertype" name="trainertype" class="lcl_texte" style="padding-top:5px;text-align:left;">
			   <?php $_from = $this->_var['trainertype']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
			   <option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['trainerType']; ?></option> 			
			   <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			   </select>
			   <script>
			   document.getElementById("trainertype").value="<?php echo $this->_var['project']['trainerType']; ?>";
			   </script>
			   </div>
            </div>
            <div class="lcl_xincon01" >
               <div class="lcl_xinconzi font20">* Training type</div>
               <div class="lcl_xinconform">
			   <select id="trainingtype" name="trainingtype" class="lcl_texte" style="padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['trainingtype']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['trainingType']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			   </select>
			   <script>
				document.getElementById("trainingtype").value="<?php echo $this->_var['project']['trainingType']; ?>";
			   </script>
			   </div>
            </div>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20">* How many training sessions</div>
               <div class="lcl_xinconform">
			   <select id="sessions" name="sessions" class="lcl_texte" style="padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['sessions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['sessionType']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			    </select> 
			    <script>
				document.getElementById("sessions").value="<?php echo $this->_var['project']['sessions']; ?>";
			    </script>
			   </div>
            </div>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20">* Length per session</div>
               <div class="lcl_xinconform">
			   <select id="length" name="length" class="lcl_texte" style="padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['length']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['lengthType']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>	
			   </select> 
			   <script>
			   document.getElementById("length").value="<?php echo $this->_var['project']['length']; ?>";
			   </script>
			   </div>
            </div>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20">* Training budget</div>
               <div class="lcl_xinconform">
			   <select id="budget" name="budget" class="lcl_texte" style="padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['budget']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['budgetType']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			   </select> 
			   <script>
				document.getElementById("budget").value="<?php echo $this->_var['project']['budget']; ?>";
			   </script>
			   </div>
            </div>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20">* Quoting open</div>
               <div class="lcl_xinconform">
			   <select id="quoting" name="quoting" class="lcl_texte" style="padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['quoting']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['quotingType']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			   </select>
			   <script>
				document.getElementById("quoting").value="<?php echo $this->_var['project']['quoting']; ?>";
			   </script> 
			   </div>
            </div>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20">* City/Town</div>
                <div class="lcl_xinconform"><input type="text" name="province" id="my_address" class="lcl_texte01" value="<?php echo $this->_var['project']['city']; ?>" style="text-align:left;" onkeyup="showHint(this.value)" />
			  
			    <div id="txtHint" style="position:absolute;width:201px;height:10px;z-index:2;">
				
				</div> 
				
				</select>
			   </div>
			  
            </div>
         <p class="font_itsfun"><img src="themes/default/images/l_31.gif">It's fun to bring your friends</p>
            <div class="lcl_xincon01" >
            	<div class="lcl_xinconzi font20" style="width:414px;">* How many friends do you intend to bring</div>
              	<div class="lcl_xinconform" style="width:198px;">
			  	<select class="lcl_texte" id="friends" name="friendsnum" style="width:150px;height:30px;padding-top:5px;text-align:left;">
				<?php $_from = $this->_var['friends']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['value']):
?>
				<option value="<?php echo $this->_var['value']['num']; ?>" ><?php echo $this->_var['value']['friendsnum']; ?></option> 			
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			  	</select> 
			  	<script>
				document.getElementById("friends").value="<?php echo $this->_var['project']['friends']; ?>";
			  	</script>
			  	</div>
            </div>
			<p class="lcl_xincon01 font20"  style="padding-left:20px;">
             	Special Requests<br /><span class="font08">&nbsp;&nbsp;(Do you have any health issues/requests for trainers to know?)</span>
            </p>
            <div class="lcl_textaread">
             	<input name="special" cols="" rows="" class="lcl_texte01" maxlength="100" style="width:635px; text-align:left;" value="<?php echo $this->_var['project']['specialReq']; ?>"  />
            </div>
            <p class="lcl_xincon01 font20" >
             	* Details about your training goals<br /><span class="font08">&nbsp;&nbsp;(add info about your friends as well if you plan bring friends)</span>
            </p>
            <div class="lcl_textaread">
             	<textarea name="content" cols="" rows="" class="lcl_textarea" maxlength="2000" ><?php echo $this->_var['project']['content']; ?></textarea>
            </div>
			<?php if ($this->_var['login_flag'] == 0): ?>			
			<p class="font_listt" style="margin-top:20px;">2. About you</p>
				<ul class="lcl_about">
             	<li class="font11 lcl_email">* Account type</li>
                <li style="padding-top:2px; width:20px; height:15px;"><input id="change_tab" name="change_tab" type="radio" value="register" onclick="registertab()" checked="checked"/></li>
                <li class="font05"><strong>I am a new user&nbsp;&nbsp;</strong></li>
                <li style="padding-top:2px; width:20px; height:15px;"><input id="change_tab" name="change_tab" type="radio" value="login" onclick="logintab()"/></li>
                <li class="font05"><strong>I have an account</strong></li>
             	</ul>
		 		<div class="register" id="register" name='register'>
         			<ul class="lcl_about">
       	   			<li class="font_05 lcl_email"><strong>Email address*</strong></li>
               		<li><input name="email_register" type="text" class="lcl_tet" onblur="checkEmail(this.value);"/></li>
					<li id="email_notice" style="color:#FF0000; font-size:9px; "></li>
         			</ul>
             		<ul class="lcl_about">
             		<li class="font_05 lcl_email"><strong>Pick a username*</strong></li>
                	<li ><input name="username" type="text" class="lcl_tet" onblur="is_registered(this.value);"  /></li>
					<li><span id="username_notice" style="color:#FF0000; font-size:9px; "></span></li>
             		</ul>
             		<ul class="lcl_about">
           	   		<li class="font_05 lcl_email" ><strong>Create password*</strong></li>
                	<li><input name="password_register" type="password" class="lcl_tet" onblur="check_password(this.value);"/></li>
					<li><span style="color:#FF0000; font-size:9px; " id="password_notice"></span></li>
         			</ul>
             		<ul class="lcl_about">
           	   		<li class="font_05 lcl_email"><strong>Confirm password*</strong></li>
                	<li><input name="confirm_password" type="password" class="lcl_tet" onblur="check_conform_password(this.value);"  /></li>
					<li><span style="color:#FF0000; font-size:9px; " id="conform_password_notice"></span></li>
         			</ul>
		 		</div>
		 		<div class="login" id="login" name='login' style="display:none">
         	 		<ul class="lcl_about">
       	   			<li class="font05 lcl_email"><strong>Email address*</strong></li>
                	<li><input name="email_login" type="text" class="lcl_tet" /></li>
         	 		</ul>
             		<ul class="lcl_about">
           	    	<li class="font05 lcl_email"><strong>Password*</strong></li>
                	<li><input name="password_login" type="password" class="lcl_tet" /></li>
         	 		</ul>             
		 		</div>				
         		<div class="font_08">By clicking on "Continue" I agree to terms of service</div>				 			          
			 <?php endif; ?>	
			 <div class="como_button">
			 <input name="" type="submit" class="l_bom04d font06" value="Continue" />
			 <?php if ($this->_var['action'] == 'add'): ?>
			 <input type="hidden" name="act" value="act_add" />
			 <?php elseif ($this->_var['action'] == 'edit'): ?>
			 <input type="hidden" name="act" value="act_edit" />
			 <input type="hidden" name="pid" value="<?php echo $this->_var['pid']; ?>" />
			 <?php endif; ?>
		  </div>		             			        
       	  </div>
		    
       	  <div class="lcl_llin"></div>
 	 </form> 
<div class="lcl_llin"></div>
<script type="text/javascript">


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1848127-18']);
  _gaq.push(['_setDomainName', '.fitwow.com']);
  _gaq.push(['_trackPageview']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

function registertab()
{
  var tabContent1 = document.getElementById('register'),
  tabContent2 = document.getElementById('login');
  
  tabContent1.style.display="block";
  tabContent2.style.display="none";
}

function logintab()
{

  var tabContent1 = document.getElementById('register'),
  tabContent2 = document.getElementById('login');
  
  tabContent1.style.display="none";
  tabContent2.style.display="block";
}

var xmlHttp;

function showHint(str)
{
	if (str.length==0)
  	{ 
  		document.getElementById("txtHint").innerHTML="";
 		return;
  	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request");
  		return;
  	} 
	var url="projects.php";
	url=url+"?act=act_get_address&q="+str;
	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=stateChanged; 
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("txtHint").style.display = 'block';
 		document.getElementById("txtHint").innerHTML=xmlHttp.responseText; 
 	} 
}

function hideName()
{
	
	document.getElementById("txtHint").style.display = 'none';
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		// Internet Explorer
 		try
  		{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
 	}
	return xmlHttp;
}



function get_string(obj) 
{
  
  	document.getElementById("my_address").value = obj.innerHTML;
  	document.getElementById("txtHint").style.display = 'none';
}

function change_color(obj) 
{
	
  	obj.style.background= "#00CCFF";
}


function back_color(obj) 
{
	
  	obj.style.background= "#F2F2F2";
}

</script>


<?php echo $this->fetch('library/page_footer.lbi'); ?>

</body>

</html>
